﻿using System.Data.Entity;

namespace ExcelToVT
{
    public class Kontext : DbContext
    {
        public Kontext(string connectionString)
            : base(connectionString) { }

        protected override void OnModelCreating(DbModelBuilder mb)
        {
            mb.Entity<Ilac>().Map(p => p.ToTable("Ilaclar"));

            mb.Entity<Ilac>().Property(p => p.id).HasColumnName("id").IsRequired();
            mb.Entity<Ilac>().Property(p => p.skrs_barkod).HasColumnName("skrs_barkod").IsRequired();
            mb.Entity<Ilac>().Property(p => p.skrs_durum).HasColumnName("skrs_durum");
            mb.Entity<Ilac>().Property(p => p.skrs_firma).HasColumnName("skrs_firma");
            mb.Entity<Ilac>().Property(p => p.skrs_ilac_adi).HasColumnName("skrs_ilac_adi");
            mb.Entity<Ilac>().Property(p => p.skrs_recete_turu).HasColumnName("skrs_recete_turu");

            mb.Entity<Ilac>().HasKey(p => p.id);

            mb.Entity<ExcelDosya>().Map(a => a.ToTable("ExcelDosyalari"));
            mb.Entity<ExcelDosya>().HasKey(a => a.id);
        }
        public DbSet<Ilac> Ilaclar { get; set; }
        public DbSet<ExcelDosya> ExcelDosyalari{ get; set; }
    }
}
